//
//  MsonryVC.m
//  FrameWork2.0
//
//  Created by jiaming yan on 16/10/19.
//  Copyright © 2016年 yanjiaming. All rights reserved.
//

#import "MsonryVC.h"
#import "Masonry.h"
#import "UILabel+MyLabel.h"
@interface MsonryVC ()

@end

@implementation MsonryVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    UIView *aView1 = [[UIView alloc]init];
    aView1.backgroundColor = kBlackColor;
    [self.view addSubview:aView1];
    [aView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view.mas_top).with.offset(10); //with is an optional semantic filler
        make.left.equalTo(self.view.mas_left).with.offset(10);
        make.right.equalTo(self.view.mas_right).with.offset(-10);
        make.height.offset(100);
    }];
    
 
    
    
    
    UIView *aView2 = [[UIView alloc]init];
    aView2.backgroundColor = kBlackColor;
    [self.view addSubview:aView2];
    [aView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(aView1.mas_bottom).offset(10); //with is an optional semantic filler
        make.left.equalTo(aView1.mas_left);
        make.right.equalTo(aView1.mas_right);
        make.height.equalTo(aView1.mas_height);
    }];
    
    UIView *aView3 = [[UIView alloc]init];
    aView3.backgroundColor = kBlackColor;
    [self.view addSubview:aView3];
    [aView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(aView2.mas_bottom).offset(10); //with is an optional semantic filler
        make.left.equalTo(aView1.mas_left);
        make.right.equalTo(aView1.mas_right);
        make.height.equalTo(aView1.mas_height);
    }];
    
    UILabel *lab1 = [UILabel labelWithFontSize:k14Font textColor:kGreenColor];
    lab1.text = @"adsfadsfasddsfadsfas";
    lab1.backgroundColor = kRedColor;
    [aView3 addSubview:lab1];
    [lab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@10); //with is an optional semantic filler
        make.left.equalTo(@10);
        make.height.equalTo(@20);
    }];
    
    UILabel *lab2 = [UILabel labelWithFontSize:k14Font textColor:kRedColor];
    lab2.text = @"adsfadsfasdfsaadsfadsfasdfsaadsfadsfasdfsaadsfadsfasdfsa";
    lab2.backgroundColor = kGreenColor;
    [aView3 addSubview:lab2];
    [lab2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@10); //with is an optional semantic filler
        make.left.equalTo(lab1.mas_right).with.offset(10);
        make.right.lessThanOrEqualTo(@-10);
        make.height.equalTo(@20);
    }];
    
    UILabel *lab3 = [UILabel labelWithFontSize:k14Font textColor:kRedColor];
    lab3.text = @"adsfadsfasdfsaadsfadsfasdfsaadsfadsfa";
    lab3.backgroundColor = kGreenColor;
    [aView3 addSubview:lab3];
    [lab3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(lab1.mas_bottom).with.offset(5); //with is an optional semantic filler
        make.left.equalTo(lab1.mas_left);
        make.right.lessThanOrEqualTo(@-10);
        make.height.equalTo(@20);
    }];
    
//    [lab1 mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(aView3.mas_top).offset(10); //with is an optional semantic filler
//        make.left.equalTo(aView3.mas_left).offset(10);
//        make.right.lessThanOrEqualTo(aView3.mas_right).offset(10);
//    }];
    
    UIImageView *image = [[UIImageView alloc]init];
    [image sd_setImageWithURL:[NSURL URLWithString:@"http://hit.stat.hiapk.com/uploads/allimg/160727/928-160HG45H7-50.jpg"]];
    image.backgroundColor = kBlackColor;
    [self.view addSubview:image];
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(aView3.mas_bottom).offset(10); //with is an optional semantic filler
        make.left.equalTo(aView3.mas_left);
        
        make.right.equalTo(aView3.mas_right);
        
        make.height.equalTo(image.mas_width).multipliedBy(0.5);
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
